/**
 * Declare which test methods should be run in which order
 * @type Array
 * @final
 */
var tests = [
   "testEncode",
   "testDecode"
];

/**
 * Tests the basic hash encode function
 */
var testEncode = function() {
    // Simple tests
    assertEqual(encodeHash(1), "1");
    assertEqual(encodeHash(2), "2");
    assertEqual(encodeHash(3), "3");
    
    // Upper case characters are expected
    assertEqual(encodeHash(10), "A");
    assertEqual(encodeHash(11), "B");
    assertEqual(encodeHash(12), "C");
    assertEqual(encodeHash(13), "D");
    assertEqual(encodeHash(14), "E");
    assertEqual(encodeHash(15), "F");
    
    // Lower case tests - should all fail
    assertNotEqual(encodeHash(10), "a");
    assertNotEqual(encodeHash(11), "b");
    assertNotEqual(encodeHash(12), "c");
    assertNotEqual(encodeHash(13), "d");
    assertNotEqual(encodeHash(14), "e");
    assertNotEqual(encodeHash(15), "f");
    return;
};

/**
 * Tests the basic hash decode function
 */
var testDecode = function() {
    // Simple tests
    assertEqual(decodeHash("1"), 1);
    assertEqual(decodeHash("2"), 2);
    assertEqual(decodeHash("3"), 3);
    
    // Upper case characters are expected
    assertEqual(decodeHash("A"), 10);
    assertEqual(decodeHash("B"), 11);
    assertEqual(decodeHash("C"), 12);
    assertEqual(decodeHash("D"), 13);
    assertEqual(decodeHash("E"), 14);
    assertEqual(decodeHash("F"), 15);
    
    // Check invalid hashes
    assertNaN(decodeHash("abcdef"));
    assertNotNaN(decodeHash("ABCDEF"));
    assertNaN(decodeHash("rtf"));
    assertNotNaN(decodeHash("123"));
    
    return;
};